package com.lamer.console.blog.controller;


import com.lamer.console.blog.entity.Article;
import com.lamer.console.blog.service.IArticleService;
import com.lamer.console.common.api.ApiResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 黄诗鹏
 * @since 2021-11-23
 */
@RestController
@RequestMapping("/blog")
public class ArticleController {

    @Autowired
    private IArticleService articleService;

    @PostMapping("/article/")
    public ApiResult<String> insertData(@RequestBody Article data) {
        boolean flag = articleService.save(data);
        return flag ? ApiResult.success() : ApiResult.failed();
    }

}

